/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.giant.entities.pos;

import com.giant.entities.InOpCen;
import com.giant.entities.Person;
import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author harold
 */
@Entity
@Table(name = "p_pos")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "PPos.findAll", query = "SELECT p FROM PPos p"),
    @NamedQuery(name = "PPos.findByIdPos", query = "SELECT p FROM PPos p WHERE p.idPos = :idPos"),
    @NamedQuery(name = "PPos.findByName", query = "SELECT p FROM PPos p WHERE p.name = :name"),
    @NamedQuery(name = "PPos.findByAddress", query = "SELECT p FROM PPos p WHERE p.address = :address"),
    @NamedQuery(name = "PPos.findByShortName", query = "SELECT p FROM PPos p WHERE p.shortName = :shortName"),
    @NamedQuery(name = "PPos.findByStatus", query = "SELECT p FROM PPos p WHERE p.status = :status")})
public class PPos implements Serializable {

    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id_pos")
    private Integer idPos;
    @OneToOne
    @JoinColumn(name = "id_op_cen")
    private InOpCen idOpCen;
    @OneToOne
    @JoinColumn(name = "id_person")
    private Person idPerson;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 100)
    @Column(name = "name")
    private String name;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 100)
    @Column(name = "address")
    private String address;
    @Basic(optional = false)
    @Size(min = 1, max = 50)
    @NotNull
    @Column(name = "short_name")
    private String shortName;
    @Basic(optional = false)
    @NotNull
    @Column(name = "status")
    private boolean status;
   

    public PPos() {
    }

    public PPos(Integer idPos) {
        this.idPos = idPos;
    }

    public PPos(Integer idPos, InOpCen inOpCen, Person person, String name, String address, String shortName, boolean status) {
        this.idPos = idPos;
        this.idOpCen=inOpCen;
        this.idPerson=person;
        this.name = name;
        this.address = address;
        this.shortName = shortName;
        this.status = status;
    }

    public InOpCen getIdOpCen() {
        return idOpCen;
    }

    public void setIdOpCen(InOpCen idOpCen) {
        this.idOpCen = idOpCen;
    }
    
    public Integer getIdPos() {
        return idPos;
    }

    public void setIdPos(Integer idPos) {
        this.idPos = idPos;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public String getShortName() {
        return shortName;
    }

    public void setShortName(String shortName) {
        this.shortName = shortName;
    }

    public boolean getStatus() {
        return status;
    }

    public void setStatus(boolean status) {
        this.status = status;
    }

    public Person getIdPerson() {
        return idPerson;
    }

    public void setIdPerson(Person idPerson) {
        this.idPerson = idPerson;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idPos != null ? idPos.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof PPos)) {
            return false;
        }
        PPos other = (PPos) object;
        if ((this.idPos == null && other.idPos != null) || (this.idPos != null && !this.idPos.equals(other.idPos))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.giant.entities.PPos[ idPos=" + idPos + " ]";
    }
}
